<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生信息管理系统 - 用户登录</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
        }
        .login-container {
            width: 100%;
            max-width: 400px;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="form-container">
            <h1>用户登录</h1>
            
            <!-- 显示消息提示 -->
            <% if (request.getAttribute("message") != null) { %>
                <div class="message success">
                    <%= request.getAttribute("message") %>
                </div>
            <% } %>
            
            <% if (request.getAttribute("error") != null) { %>
                <div class="message error">
                    <%= request.getAttribute("error") %>
                </div>
            <% } %>
            
            <div class="error-container" style="display: none;"></div>
            
            <form id="loginForm" action="<%= request.getContextPath() %>/UserServlet" method="post" data-validate>
                <input type="hidden" name="action" value="login">
                <div class="form-group">
                    <label for="username">用户名</label>
                    <input type="text" id="username" name="username" required placeholder="请输入用户名">
                </div>
                
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" id="password" name="password" required placeholder="请输入密码">
                </div>
                
                <div class="form-group" style="display: flex; align-items: center;">
                    <input type="checkbox" id="rememberMe" name="rememberMe" style="width: auto; margin-right: 10px;">
                    <label for="rememberMe" style="margin-bottom: 0;">记住我</label>
                </div>
                
                <div class="form-group">
                    <button type="submit" class="btn btn-primary btn-block">登录</button>
                </div>
                
                <div style="text-align: center; margin-top: 20px;">
                    还没有账号？<a href="register.jsp">立即注册</a>
                </div>
                
                <div style="text-align: center; margin-top: 10px;">
                    <a href="#" onclick="showMessage('请联系管理员重置密码', 'info'); return false;">忘记密码？</a>
                </div>
            </form>
        </div>
    </div>
    
    <script src="js/script.js"></script>
</body>
</html>